---
title: OBRetentionService business rules
summary: Rules the application enforces around the ArchiveDocument call.
status: draft
owner: ProcessOB3PRetention team
last_reviewed: 2026-10-22
---

# OBRetentionService business rules

The application enforces four rules of its own around the `ArchiveDocument` call: how claims are batched, when the call is skipped, how the request is built, and the order of archive and mark-processed. Rules enforced by the remote service are outside this repository and are not restated here.

---

## BR-OBR-001 Batch claims by configured size

| Field | Value |
| --- | --- |
| Statement | Claim numbers are partitioned into batches of the configured size, and `ArchiveDocument` is called once per batch |
| Trigger | Evaluated in `ThirdPartyRetentionProcessor.Execute` before the first call |
| Enforcement | The size comes from the setting `processob3pretention.processbatchsize`; the key must exist — `GetConfigSetting` throws `ApplicationException` if it is absent — but once a value is returned, an empty, non-numeric, zero, or negative value falls back to 100 |
| Origin | call site |
| Outcome | The seeded value is 200 on `prod`, `entqa`, and `npuat` per `environmentSettings/settings.yml`; a present-but-invalid value silently becomes 100, while a missing key fails the run (exit 5) before any claim is processed |
| Related operation | [`ArchiveDocument`](reference.md#archivedocument) |
| Source | `ProcessOB3PRetention/ThirdPartyRetentionProcessor.cs:41`, `ProcessOB3PRetention/ThirdPartyRetentionProcessor.cs:70` |

---

## BR-OBR-002 Skip the call when no claims are eligible

| Field | Value |
| --- | --- |
| Statement | The operation is not called when the claim source returns zero claims |
| Trigger | After the eligible claims are fetched, before batching |
| Enforcement | Length check in `ThirdPartyRetentionProcessor.Execute` |
| Origin | call site |
| Outcome | No call is made and the processor logs that no claims are eligible |
| Related operation | [`ArchiveDocument`](reference.md#archivedocument) |
| Source | `ProcessOB3PRetention/ThirdPartyRetentionProcessor.cs:39` |

---

## BR-OBR-003 Build the request from a fixed placeholder document and the batch claim numbers

| Field | Value |
| --- | --- |
| Statement | Every request carries the same placeholder text document and the batch's claim numbers as standalone keywords |
| Trigger | Each call to `OnBaseService.ProcessRetention`, before `ArchiveDocument` |
| Enforcement | Message construction in the wrapper; `FileInfo.MIMEType` and `FileInfo.Base64FileStream` are literals and `Keywords.StandAlone.ClaimNumber_Collection` is the supplied claim numbers |
| Origin | wrapper |
| Outcome | The remote service receives identical document content on every call, varying only by claim numbers |
| Related operation | [`ArchiveDocument`](reference.md#archivedocument) |
| Source | `ProcessOB3PRetention/Services/OnBaseService.cs:24` |

---

## BR-OBR-004 Archive first, then mark the batch processed

| Field | Value |
| --- | --- |
| Statement | A batch is marked processed only after `ArchiveDocument` returns without an exception |
| Trigger | Inside the batch loop of `ThirdPartyRetentionProcessor.Execute` |
| Enforcement | Sequencing of the `ProcessRetention` call and `MarkRetentionClaimsAsProcessed` |
| Origin | call site |
| Outcome | If archiving throws, the run stops and the batch is not marked. If marking fails after archiving, the batch was sent but is not recorded as processed |
| Related operation | [`ArchiveDocument`](reference.md#archivedocument) |
| Source | `ProcessOB3PRetention/ThirdPartyRetentionProcessor.cs:52` |

---

## Related documentation
- [Client index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Contract](contract.md)
- [Operation map](operation-map.md)
- [Client reference](reference.md)
- [Consumption](consumption.md)
- [Dependencies](dependencies.md)
- [Tech debt](tech-debt.md)

## Sources
- ProcessOB3PRetention/ThirdPartyRetentionProcessor.cs
- ProcessOB3PRetention/Services/OnBaseService.cs
- environmentSettings/settings.yml
